<template>
	<view>
		<view class="Comcontent " style="background-color:#7adf55; margin-top: 50rpx;">
			<text class="title">子组件B</text>
			<view class="comb_box">
				<text>ComA组件传来的值：</text>
				<text style="background-color: blue; color: white;">{{result}} </text>
			</view>
			<view class="comb_box" style=" display:flex; ;align-items: center;flex-direction: row;">
				<view style="justify-content: center; flex-direction: row; display: flex;">
				<text >回传值：</text>
				<input type="text" v-model="backValue" style="color: yellow; background-color:#b8b8b8; width: 120px;"/>
				</view>
				<button @click="sendOutside()" size="mini" style="width: 30%; margin-left: 20rpx;">回传</button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name:"comB",
		data() {
			return {
				title:"",
				result:"",
				backValue:""
			};
		},
		created() {
			console.log("ComB-----created");
			uni.$on('SendIntent',(msg)=>{
				console.log("SendIntent--ComB get Intent"+msg);
				this.result=msg
			})
		},
		mounted() {
			console.log("ComB-----mouted");
		},
		methods:{
			sendOutside(){
				console.warn("-------------ComB-sendOutside------->"+this.backValue);
				this.$emit('callBackFun',this.backValue);
			}
		}
	}
</script>

<style>
	.Comcontent{
		width: 80%;
		padding: 10rpx;
		margin: 0 auto;
		
	}
</style>